package com.itheima;

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Date2Demo {

    public static void main(String[] args) {

        Calendar calendar = Calendar.getInstance();
        //calendar.add(Calendar.MONTH, 1);
        calendar.set(Calendar.DAY_OF_MONTH,1);
        calendar.add(Calendar.DAY_OF_MONTH, -1);
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String format = simpleDateFormat.format(calendar.getTime());
        System.out.println(format);
    }
}
